package game.view.panel.game
{
	import com.base.type.LayerEnum;
	import game.view.base.gamepanel.LostPanelUI;
	import game.model.GameData;
	import game.model.type.*;
	import game.util.*;
	import flash.display.*;
	import flash.events.*;
	import flash.net.*;
	import com.net.SocketManage;
	public class LostPanel extends LostPanelUI
	{
		public function LostPanel()
		{
			super();
			setLayerType(LayerEnum.LAYER_SINGLE);
		}
		override protected function initialize():void
		{
			super.initialize();
			closeBtn.addEventListener(MouseEvent.CLICK,closeBtnClick);
			autoCloseBtn.addEventListener(MouseEvent.CLICK,autoCloseBtnClick);
			closeBtn.visible=autoCloseBtn.visible=false;
			
			//autoCloseBtn.setLabel('停止跳跃','退出自动状态');
			closeBtn.setLabel('重新开始','');
			closeBtn.nameLabel.y=20;
			closeBtn.nameLabel2.text='';
		}
		override protected function reset():void
		{
			super.reset();
			if(GameData.instance.automaticIndex!=Enum.no_num){
				//autoCloseBtn.visible=true;
			}else{
				//closeBtn.visible=true;
			}
			closeBtn.visible=true;
		}
		private function autoCloseBtnClick(e:MouseEvent):void{
			this.closeBtnClick(null);
		}
		private function closeBtnClick(e:MouseEvent):void{	
			var vo:Object={"cmd": "FailChoose", "params": {'type':1}};
			SocketManage.instance.sendUTF(JSON.stringify(vo));
			
			ZooMain.view.closeView(LostPanel);
		}
		override protected function dispose():void{
			closeBtn.removeEventListener(MouseEvent.CLICK,closeBtnClick);
			autoCloseBtn.removeEventListener(MouseEvent.CLICK,autoCloseBtnClick);
			super.dispose();
		}
	}
}